// import Mock from 'mockjs'
import store from '../store'
const TokenKey = 'token'

function getToken() {
  return sessionStorage.getItem(TokenKey)
}

function setToken(token) {
  return sessionStorage.setItem(TokenKey, token)
}

function removeToken() {
  return sessionStorage.removeItem(TokenKey)
}
function clearTokenAndStore(){
  removeToken();
  store.commit('SET_TOKEN','');
  store.commit('SET_NAME','');
  store.commit('SET_AGE','');
  store.commit('SET_AVATAR','');
  store.commit('SET_PERMISSIONS','');
  store.commit("SET_ROUTERS",[]);
  store.commit('SET_SOCKET',null);
}

export { getToken, setToken, removeToken,clearTokenAndStore }
